The point to keep in mind with respect to variables in XSLT is that they are not like variables in procedural languages (perl, java, etc.) but rather like variables in algebraic equations - taking on a [potentially] different value for each run - but not modifiable within a single run. That, and the fact that they are very tightly scoped.
I believe, given the example XML provided, that the following does essentially what you want:[html][/html]You might be able to condense it a bit, but I think the above provides a cleaner mechanism for scaling while maintaining readability.
One looks at the code and it seems to scream for making the replicant index number a variable so you could just set that and avoid all the extra verbiage - however that doesn't work as the variable will not get evaluated in string context and will instead always return 1 (true) indicating that the variable exists, rather than it's actual value.
I dont beleive that is the issue here. From what i see in the sample XML, locale is based on unique field in the DCR (Root/language), so i dont see How the locale would change in a single run.
do you have to hard-code the replicant index? as you already know the replicants can be moved up and down which changes the index of a container. there is also a chance that the user might add a container for "fr_CA" any where in the DCR, it could be in top (1), middle (2)... there is nothing that restricts the user to maintain the order.
I am not sure if i understand this part, I know variables in XSL get evaluated in string context.
Finally, I thought Andy is trying to get this to work in SP, does that XSL code work in SP?
Neither variables nor params get evaluated as strings in a select attribute context. ...It will look like it does the right thing if locale is set to "en_US" - but you'll see that it does not do the right thing is you set it to "es_US" or "fr_CA" - because $idx, within the select attribute string, will always evaluate to "1" (true).Perhaps - but the XSL I wrote was to deal with parsing the XML that was provided - which it does, just not as optimally as it could have (why I didn't see that inner language element I have no idea)